//
//  PainterTextVolume.m
//  ChartRefactor
//
//  Created by CaoJun on 15/4/3.
//  Copyright (c) 2015年 CaoJun. All rights reserved.
//

#import "PainterTextVolume.h"

using namespace std;
using namespace ytx;

@implementation PainterTextVolume

- (NSString *) leftSideTextTransform:(double) value withViewModelIndexPosition:(ViewModelIndexPosition *) indexPosition
{
    int round = 1;
    string unit = Config::getInstance()->chartTemplate.volumeUnit;
    string msg = "";
    int selfToFix = 0;
    if (value >= 10000 && value < 100000000) {
        round = 10000;
        msg = "万";
        selfToFix = 1;
    } else if (value >= 100000000) {
        round = 100000000;
        msg = "亿" + unit;
        selfToFix = 1;
    } else if (value < 10000) {
        round = 1;
        msg = unit;
    }
    
    return  [NSString stringWithUTF8String:(Tools::Convert2FixString(value / round, selfToFix) + msg).c_str()];
}

@end
